#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 1e5+10;

int x[N],y[N],tx[N],ty[N],n;
ll ans = 1e18,psx[N],ssx[N],psy[N],ssy[N];

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in; for(int i = 1;i <= n;i++) x[i] = in,y[i] = in,tx[i] = x[i] + y[i],ty[i] = x[i] - y[i],x[i] = tx[i],y[i] = ty[i];
	sort(tx + 1,tx + n + 1); sort(ty + 1,ty + n + 1);
	for(int i = 1;i <= n;i++) psx[i] = psx[i-1] + tx[i],psy[i] = psy[i-1] + ty[i];
	for(int i = n;i >= 1;i--) ssx[i] = ssx[i+1] + tx[i],ssy[i] = ssy[i+1] + ty[i];
	for(int i = 1;i <= n;i++){
		int px = lower_bound(tx + 1,tx + n + 1,x[i]) - tx;
		int py = lower_bound(ty + 1,ty + n + 1,y[i]) - ty;
		ll tmp = 1ll * px * x[i] - psx[px] + ssx[px + 1] - 1ll * x[i] * (n - px);
		tmp += 1ll * py * y[i] - psy[py] + ssy[py + 1] - 1ll * y[i] * (n - py);
		ans = min(ans,tmp);
	}printf("%lld\n",ans/2);
	return 0;
}

